﻿<html>
  <head>
    <meta name="source" content="http://www.terrainformatica.com/wiki/doku.php?id=h-smile:built-in-behaviors:edit"/>
    <meta name="generator" content="h-smile:richtext"/>
  </head>
<body>
  <h1>behavior: password</h1>
  <p>Standard single line input element behavior. This behavior can be applied to any element that has <code>flow:text</code> and <code>white-space:pre</code> model.</p>
  <h2>Elements</h2>
  <p>that have this behavior applied by default:</p>
  <ul>
    <li><code>&lt;input type=&quot;password&quot; /&gt;</code> - inline password input element</li></ul>
  <h2>Attributes</h2>
  <p>that this behavior knows about:</p>
  <ul>
    <li><code>value=&quot;text&quot;</code> - initial value of the input element</li>
    <li><code>size=integer</code> - determines value of (intrinsic and default) width of the element.</li>
    <li><code>maxlength=integer</code> - maximum number of characters that this element can contain.</li>
    <li><code>filter=&quot;filter-expr&quot;</code> - limits set of characters allowed to input in the field. <code>filter-expr</code> string accepts single characters and character ranges. Example: &quot;.@0~9a~zA~Z&quot; - all alpha-numeric characters, '.' and '@'. If you just want to exclude some characters then you can prepend filter with '^' sign. So this <code>filter=&quot;^.,-&quot;</code> filter will allow to input any character except '.', ',' and '-'.</li>
    <li><code>novalue=&quot;text&quot;</code> - if textbox is empty then it shows text provided by the <em>novalue</em> attribute. You can style this state by using <code>:empty</code> CSS selector.</li>
    <li><code>readonly</code> - &nbsp;declares that element is read only.</li>
    <li><code>password-char=&quot;*&quot;</code> - password char placeholder.</li></ul>
  <h2>Events</h2>
  <p>Together with the standard set of events (mouse, keyboard, focus) <em>behavior: button</em> generates:</p>
  <ul>
    <li>EDIT_VALUE_CHANGED event - value of the element was changed due to user actions. Posted (asynchronous) event.</li>
    <li>EDIT_VALUE_CHANGING event - sent when value of the element is about to change. Synchronous event.</li></ul>
  <h2>Value</h2>
  <p>string, reflects current status of internal editing buffer.</p>
  <h2>Special key combinations</h2>
  <ul>
    <li>LEFT, CTRL+LEFT, SHIFT+LEFT, CTRL+SHIFT+LEFT</li>
    <li>RIGHT, CTRL+RIGHT, SHIFT+RIGHT, CTRL+SHIFT+RIGHT</li>
    <li>HOME, SHIFT+HOME</li>
    <li>END, SHIFT+END</li>
    <li>BACKSPACE, ALT+BACKSPACE, CTRL+BACKSPACE</li>
    <li>CTRL+A</li>
    <li>DELETE, SHIFT+DELETE, CTRL+DELETE</li>
    <li>INSERT, SHIFT+INSERT, CTRL+INSERT</li>
    <li>CTRL+X</li>
    <li>CTRL+V</li>
    <li>CTRL+Z</li>
    <li>CTRL+(LEFT)SHIFT and CTRL+(RIGHT)SHIFT - in forms having the <code>dir</code> attribute these key combinations switches between <code>dir=&quot;ltr&quot;</code> and <code>dir=&quot;rtl&quot;</code>.</li></ul>
  <h2>Methods</h2>
  <dl>
    <dt><code>canUndo</code></dt>
    <dd><code>(): true|false</code> - returns true if undo buffer is not empty.</dd>
    <dt><code>doUndo</code></dt>
    <dd><code>(): true|false</code> - discards last change in edit box, returns true if changes were made.</dd>
    <dt><code>canRedo</code></dt>
    <dd><code>(): true|false</code> - returns true if redo buffer is not empty.</dd>
    <dt><code>doRedo</code></dt>
    <dd><code>(): true|false</code> - applies last change, returns true if changes were made.</dd>
    <dt><code>canCut</code></dt>
    <dd><code>(): true|false</code> - returns true if selection exists and the element is not readonly.</dd>
    <dt><code>doCut</code></dt>
    <dd><code>(): true|false</code> - removes characters in selection and puts them into the clipboard, returns true if changes were made.</dd>
    <dt><code>canCopy</code></dt>
    <dd><code>(): true|false</code> - returns true if selection exists.</dd>
    <dt><code>doCopy</code></dt>
    <dd><code>(): true|false</code> - copies characters in selection to the clipboard, returns true if changes were made.</dd>
    <dt><code>canPaste</code></dt>
    <dd><code>(): true|false</code> - returns true if the clipboard contains text.</dd>
    <dt><code>doPaste</code></dt>
    <dd><code>(): true|false</code> - inserts characters from the clipboard at current caret position, returns true if changes were made.</dd>
    <dt><code>canSelectAll</code></dt>
    <dd><code>(): true|false</code> - returns true if the element is not empty.</dd>
    <dt><code>doSelectAll</code></dt>
    <dd><code>(): true|false</code> - selects all characters in the edit box, returns true if changes were made.</dd>
    <dt><code>selectionStart</code></dt>
    <dd><code>(): integer</code> - &nbsp;returns start position of the selection, or caret position if there is no selection.</dd>
    <dt><code>selectionEnd</code></dt>
    <dd><code>(): integer</code> - &nbsp;returns end position of the selection, or caret position if there is no selection.</dd>
    <dt><code>selectionText</code></dt>
    <dd><code>(): string</code> - returns selected text or empty string if there is no selection.</dd>
    <dt><code>setSelection</code></dt>
    <dd><code>(anchorPos: integer, caretPos: integer)</code> - &nbsp;selects text in the edit box. If <code>anchorPos == caretPos</code> then edit box will not contain any selection and caret will be set at that position.</dd>
    <dt><code>insertText</code></dt>
    <dd><code>(text:string)</code> - inserts the text at current caret position, moves caret to the end of the text.</dd>
    <dt><code>appendText</code></dt>
    <dd><code>(text:string)</code> - appends the text to current content of the edit box, moves caret to the end.</dd></dl>
</body>
</html>